feat(leaderboards): add value search#894
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
| await this.redis.zrangebyscore(key, value, "+inf", "LIMIT", 0, 1) : | ||
| await this.redis.zrevrangebyscore(key, value, "-inf", "LIMIT", 0, 1); | ||
|
|
||
| const fallback = sort === "ASC" ? |
There was a problem hiding this comment.
I am not sure we should have a fallback here? If there is no player with the value it should probably just error.
| sort | ||
| ); | ||
| highlight = ranking - 1; | ||
| top = highlight - (highlight % 10); |
There was a problem hiding this comment.
I think it should be highlight % PAGE_SIZE. I think the code above also needs to be changed while you are at it.
| const data = interaction.getData(); | ||
| const valueInput = data.components[0].components[0].value; | ||
|
|
||
| const value = parseLeaderboardValue(valueInput); |
There was a problem hiding this comment.
I don't think this actually works? For example if it is a level leaderboard, it is actually sorting by the exp value however the user would probably be searching by the level not the exact exp someone has. Furthermore if it was a leaderboard involving time, you would need to parse the formatted time string like 1:23. I am not sure there is a good way to do this currently and provide a good experience without some changes to the schema system.
k,m,b, andt